package com.hyst.act;

import java.util.Properties;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import com.github.pagehelper.PageInterceptor;
import com.hyst.common.MyInterceptor;


@SpringBootApplication(scanBasePackages = "com.hyst")
@MapperScan("com.hyst.dao") // 不加这个注解注入dao会失败
public class MydemoApplication {

	public static void main(final String[] args) {
		System.out.println("starting................");
		SpringApplication.run(MydemoApplication.class, args);
	}
//	@Bean
//	public ValidateInterceptor validateInterceptor() {
//		// logger.info("分页插件装配完成！");
////		final PageInterceptor interceptor = new PageInterceptor();
////		final Properties properties = new Properties();
////		properties.setProperty("helperDialect", "mysql");
////		interceptor.setProperties(properties);
//		System.out.println("加载自定义拦截器...........");
//		return new ValidateInterceptor();
//	}
//	@Bean
//	public PageInterceptor pageInterceptor() {
//		// logger.info("分页插件装配完成！");
//		System.out.println("init pagehelpper");
//		final PageInterceptor interceptor = new PageInterceptor();
////		final Properties properties = new Properties();
////		properties.setProperty("helperDialect", "mysql");
////		interceptor.setProperties(properties);
//		return interceptor;
//	}

	@Bean
	public MyInterceptor myInterceptor(){
		System.out.println("init myInterceptor");
		MyInterceptor myInterceptor=new MyInterceptor();
		return myInterceptor;
	}
}
